<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<script type="text/javascript" >
var pageer={};

$(function(){
	$('#bulletinGrid').datagrid({
	    url: ctx + '/pof/Bulletin!findPage.action',
	    fit: true,
	    pagination: true,
	    queryParams:{},
	    toolbar:'#button_index',
	    rownumbers: true,
	    singleSelect:true,
	    idField: 'sid',
	    onLoadSuccess :function(data){
	    		pageer.start = data.start;
	    		pageer.currentPageNo = data.currentPageNo;
	    		pageer.lastPageNo = data.lastPageNo;
	    		pageer.pageNo = data.pageNo;
	    		pageer.pageSize = data.pageSize;
	    		pageer.total = data.total;
	    		//console.log(pageer);
	    },
	    onDblClickRow :function(rowIndex,rowData){
	    	pageer.start = rowIndex;
	    	//console.log(rowIndex);
	    	CQOA.load('extendDiv',ctx+'/pof/Bulletin!detail.action',{'entity.sid':rowData.sid},function(){
				CQOA.hideDiv('mainDiv');
				CQOA.showDiv('extendDiv');
			});
	    }
	});
	
	$('#stitle').searchbox({
	    searcher:function(value,name){
	    	$('#bulletinGrid').datagrid('reload',{
	    		'entity.title':value
	    	});
	    },
	    prompt:'请输入标题'
	});
	
	$('#bulletinAdd').bind('click',function(){
		CQOA.load('extendDiv',ctx+'/pof/Bulletin!operate.action',{},function(){
			CQOA.hideDiv('mainDiv');
			CQOA.showDiv('extendDiv');
		});
	});
	
	$('#bulletinEdit').bind('click',function(){
		var row = $('#bulletinGrid').datagrid('getSelected');
		if (!row) {
			$.messager.show({
				msg : '请选择一条数据'
			});
			return false;
		}
		CQOA.load('extendDiv',ctx+'/pof/Bulletin!operate.action',{'entity.sid':row.sid},function(){
			CQOA.hideDiv('mainDiv');
			CQOA.showDiv('extendDiv');
		});
	});
	
	
	
	
});

function comeback(){
	CQOA.hideDiv('extendDiv');
	CQOA.showDiv('mainDiv');
};

</script>
<div id="mainDiv" class="easyui-layout" fit="true" border="false">
	        <div id="easyui-title" style="display:none">
	            	公告管理
	        </div>
           <div class="top_toolbar_div" region="north" border="false">                
               <input id="stitle" style="width:300px" ></input>
            </div>
             <div id="button_index" class="top_toolbar_button_div" border="false">
                    <a href="#" class="easyui-linkbutton" id="bulletinAdd">新增</a>
                    <a href="#" class="easyui-linkbutton" id="bulletinEdit">修改</a>
                    <a href="#" class="easyui-linkbutton" id="bulletinPus">发布</a>
                    <a href="#" class="easyui-linkbutton" id="bulletinDown">下架</a>
                    <a href="#" class="easyui-linkbutton" id="bulletinDel">删除</a>
                </div>
            <div  region="center" border="false">
	           <table id="bulletinGrid" title="公告" border="false" fit="true" >
	               			<thead>
			                   <tr>
			                   	  <!-- 
			                      <th field="sid"  width="50">SID</th>
			                      <th checkbox="true"  width="50"></th>
			                      -->
			                      <th field="createUser"  width="100">发布人</th>
			                      <th field="title"  width="200">标题</th>
			                   </tr>
	               			</thead>
	       	 	</table>
           </div>
</div>
<div id="extendDiv" class="easyui-panel" style="display:none;" fit="true" border="false"></div>
<div id="targetPopup" modal="true" class="easyui-window" closed="true" style="height: 480px; width: 700px" title="选择人员"></div>


